import 'package:flutter/material.dart';
import 'package:wheel_of_fortune/utils/utils.dart';

import 'customer_button.dart';

class MessageAlerts extends StatelessWidget {
  /// 
  final content;
  /// 0-Give up, 1-Verified user
  final type;
  const MessageAlerts({this.content = '',this.type = 0,Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      color: Colors.white,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Container(
            child: Image.asset('assets/images/messages_alerts.png',),
          ),
          Container(
            padding: EdgeInsets.only(top: 45, bottom: 60),
            alignment: Alignment.center,
            child: Text(this.content,
              textAlign: TextAlign.center,
              strutStyle: StrutStyle(forceStrutHeight: true,height:1, leading: 0.9),
              style: TextStyle(color: mainColor, fontSize: 14,fontFamily: 'Avenir Next LT Pro',),
            ),
          ),
          if(this.type == 0)
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                BorderButton(title: 'Confirm',color: deepYellowColor,onTap: ()=> Navigator.of(context).pop(true),),
                BgButton(title: 'Cancel',color: deepYellowColor,onTap: ()=> Navigator.of(context).pop(false),),
              ],
            ),
          if(this.type == 1)
            Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                BgButton(title: 'UPGRADE NOW',color: deepYellowColor,onTap: ()=> Navigator.of(context).pop(true),),
                SizedBox(height: 20,),
                InkWell(
                  onTap:  ()=> Navigator.of(context).pop(false),
                  child: Text('Give up my gift',  style: TextStyle(color: grey70Color ,fontSize: 16,fontFamily: 'Avenir Next LT Pro',)),
                ),
              ],
            ),
          SizedBox(height: 30,),
        ],
      ),
    );
  }
}



class EntityAlert extends StatelessWidget {
  /// 
  final title;
  final content;
  final cancel;
  final close;
  const EntityAlert({this.content = '',this.title = '',this.cancel,this.close,Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      color: Colors.white,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Container(
            child: Image.asset('assets/images/messages_alerts.png',),
          ),
          Container(
            padding: EdgeInsets.only(top: 20, bottom: 10),
            alignment: Alignment.center,
            child: Text('Are you sure to close?',
              textAlign: TextAlign.center,
              strutStyle: StrutStyle(forceStrutHeight: true,height:1, leading: 0.9),
              style: TextStyle(color: mainColor, fontSize: 16,fontFamily: 'Avenir Next LT Pro',fontWeight: FontWeight.bold),
            ),
          ),
          Container(
            padding: EdgeInsets.only(top: 0, bottom: 40),
            alignment: Alignment.center,
            child: Text('After closing this dialogue box, you could collect\nyour gift through "My Assets-My Rewards.\nPlease collect your gift with 7 days,\notherwise it will be abandoned.',
              textAlign: TextAlign.center,
              strutStyle: StrutStyle(forceStrutHeight: true,height:1, leading: 0.9),
              style: TextStyle(color: mainColor, fontSize: 10,fontFamily: 'Avenir Next LT Pro',fontWeight: FontWeight.w400),
            ),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              BorderButton(title: 'Close',color: deepYellowColor,onTap: (){
                Navigator.of(context).pop(false);
                if (this.close!=null) {
                  this.close();
                }
              }),
              BgButton(title: 'Cancel',color: deepYellowColor,onTap: (){
                // Navigator.of(context).pop(false);
                if (this.cancel!=null) {
                  this.cancel();
                }
              },),
            ],
          ),
          SizedBox(height: 30,),
        ],
      ),
    );
  }
}

class GiftAlert extends StatelessWidget {
  
  final cancel;
  final close;
  const GiftAlert({this.cancel,this.close,Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      color: Colors.white,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Container(
            child: Image.asset('assets/images/messages_alerts.png',),
          ),
          Container(
            padding: EdgeInsets.only(top: 30, bottom: 30),
            alignment: Alignment.center,
            child: Text('Are you sure you want to\ngive up your gift?',
              textAlign: TextAlign.center,
              strutStyle: StrutStyle(forceStrutHeight: true,height:1, leading: 0.9),
              style: TextStyle(color: mainColor, fontSize: 16,fontFamily: 'Avenir Next LT Pro',fontWeight: FontWeight.w500),
            ),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              BorderButton(title: 'Confirm',color: deepYellowColor,onTap: (){
                if (this.close!=null) {
                  this.close();
                }
              }),
              BgButton(title: 'Cancel',color: deepYellowColor,onTap: (){
                if (this.cancel!=null) {
                  this.cancel();
                }
              },),
            ],
          ),
          SizedBox(height: 30,),
        ],
      ),
    );
  }
}

class AddressAlert extends StatelessWidget {
  
  final cancel;
  final close;
  const AddressAlert({this.cancel,this.close,Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.center,
      color: Colors.white,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Container(
            child: Image.asset('assets/images/messages_alerts.png',),
          ),
          Container(
            padding: EdgeInsets.only(top: 30, bottom: 30),
            alignment: Alignment.center,
            child: Text('Are you sure you want to\ndelete this address?',
              textAlign: TextAlign.center,
              strutStyle: StrutStyle(forceStrutHeight: true,height:1, leading: 0.9),
              style: TextStyle(color: mainColor, fontSize: 18,fontFamily: 'Avenir Next LT Pro',fontWeight: FontWeight.bold),
            ),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              
              BgButton(title: 'YES',color: deepYellowColor,onTap: (){
                Navigator.of(context).pop(false);
                if (this.close!=null) {
                  this.close();
                }
              },),
              BorderButton(title: 'NO',color: deepYellowColor,onTap: (){
                Navigator.of(context).pop(true);
                if (this.cancel!=null) {
                  this.cancel();
                }
              },),
            ],
          ),
          SizedBox(height: 30,),
        ],
      ),
    );
  }
}